#include <iostream>
#include <stdio.h>
#include <string>

using namespace std;

struct S1 {
	int a;
	int b;
	int c;
	int operator > (S1 two) {
		if ((a >= two.a) && (b >= two.b) && (c >= two.c)) {
			return 1;
		} else if ((a < two.a) && (b < two.b) && (c < two.c)) {
			return 0;
		} else {
			return -1;
		}
	}
};
S1 d[100000];
int n;
int flag = 0;
int main() {
	cin >> n;
	for (int i = 0; i < n; i++) {
		scanf("%d%d%d", &d[i].a, &d[i].b, &d[i].c);
	}

	int idx = 0;
	for (int i = 1; i < n; i++) {
		if ( (d[i] > d[idx]) == 1 ) {
			idx = i;
			flag = 0;
		} else if ((d[i] > d[idx]) == -1) {
			flag = 1;
		}
	}
	if (!flag) {

		cout << idx;
	} else {
		cout << -1;
	}
	return 0;
}
